package com.sgai.zero_robot.ui.history;


import static com.sgai.zero_robot.utils.ZeroUtils.getInstall;
import android.content.Context;
import android.graphics.Color;
import com.sgai.zero_robot.R;
import com.sgai.zero_robot.base.BaseAdapter;
import com.sgai.zero_robot.databinding.ItemZeroLineBinding;
import com.sgai.zero_robot.pojo.InstallInfo;


public class ZeroListAdapter extends BaseAdapter<InstallInfo, ItemZeroLineBinding> {
    private final Context context;
    private int currentIndex = 0;

    public int getCurrentIndex() {
        return currentIndex;
    }

    public void setCurrentIndex(int currentIndex) {
        this.currentIndex = currentIndex;
    }

    public ZeroListAdapter(Context context) {
        super();
        this.context = context;
    }

    @Override
    protected void onBindView(ItemZeroLineBinding binding, int position, InstallInfo installInfo) {
        if (position == currentIndex){
            binding.getRoot().setBackground(context.getResources().getDrawable(R.drawable.shape_a6ffffff_right6));
            binding.tvTitle.setTextColor(Color.BLACK);
        }else{
            binding.getRoot().setBackgroundColor(Color.TRANSPARENT);
            binding.tvTitle.setTextColor(Color.WHITE);
        }
        binding.tvTitle.setText(installInfo.lineName+installInfo.towerName+"-"+getInstall(installInfo.install));
    }
}